Closing Your Part
When the user closes the document containing your part, or when your part is deleted from its containing part, OpenDoc calls your part'sReleaseAll
method, followed by itssomUninit
method. (If, when closing a document, the user specifies that changes be saved, your part'sExternalize
method is called beforeReleaseAll
.)The ReleaseAll Method
TheReleaseAll
method is inherited fromODPersistentObject
. Its purpose is to ensure that all your part's references to other objects and ownership of shared resources are relinquished before your part is itself deleted from memory. As a minimum, your override of theReleaseAll
method should
Your part should not write itself to storage from within its
- call the
Release
methods of all reference-counted objects to which your part has references, including iterating through your part's private lists of embedded frames and display frames and releasing each one (at this point, all of them should have been released anyway)- remove any link specifications your part has written to the clipboard
- fulfill any promises your part has written to the clipboard
- relinquish all foci that your part owns
- clear the undo stack if your part has written any undo actions to it
- call the
BaseRemoved
method of any of your part's extensions- call the
PartRemoved
method of any embedded-frames iterators your part has created
ReleaseAll
method.Your part's
Release
method, inherited fromODRefCntObject
, is called under different circumstances fromReleaseAll
. For information on implementing aRelease
method, see the section "Reference-Counted Objects"The somUninit Method
After it completesReleaseAll
, your part receives no subsequent method calls except to its System Object Model (SOM) object destructorsomUninit
. ThesomUninit
method is inherited from thesomObject
class of SOM; when you subclassODPart
, you must overridesomUninit
.Your
somUninit
method should dispose of any storage created for your part object by thesomInit
method and any other storage related to additional instance variables of your part initialized during execution. In this method, do not perform any tasks that could fail.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help